home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 126-150 / disk_142 / diff / diff.doc < prev    next >
Text File  |  1992-05-06  |  6KB  |  162 lines

  1. DIFF(1)
  2.  
  3.  
  4. NAME   diff - Public Domain diff (context diff) program
  5.  
  6.  
  7. SYNOPSIS   diff [-b -c -i -e] file1 file2
  8.  
  9.  
  10. DESCRIPTION
  11.  
  12. Diff compares two files, showing what must be changed to make them
  13. identical.  Either file1 or file2 (but not both) may refer to
  14. directories.  If that is the case, a file in the directory whose
  15. name is the same as the other file argument will be used.  The
  16. standard input may be used for one of the files by replacing the
  17. argument by "-".  Except for the standard input, both files must
  18. be on disk devices.
  19.  
  20.  
  21. OPTIONS
  22.  
  23.     -b   Remove trailing whitespace (blanks and tabs) and compress
  24.          all other strings of whitespace to a single blank.
  25.  
  26.     -c   Print some context -- matching lines before and after the
  27.          non-match section.  Mark non-matched sections with "|".
  28.  
  29.     -i   Ignore lower/upper case distinctions.
  30.  
  31.     -e   Output is in an "editor script" format which is compatible
  32.          with the Unix 'ed' editor.
  33.  
  34.  
  35. All information needed to compare the files is maintained in main
  36. memory.  This means that very large files (or fairly large files
  37. with many differences) will cause the program to abort with an
  38. "out of space" message.  Main memory requirements (in words) are
  39. approximately:
  40.  
  41.       2 * (length of file1 + length of file2) + (3 * number of changes)
  42.  
  43. where "length" is the number of lines of data in each file.
  44.  
  45.  
  46. The algorithm reads each file twice, once to build hash tables
  47. and once to check for fortuitous matches (two lines that are in
  48. fact different, but which have the same hash value).  CPU time
  49. requirements include sorting the hash tables and randomly
  50. searching memory tables for equivalence classes.  For example, on
  51. a time-shared VAX-11/780, comparing two 1000 line files required
  52. about 30 seconds (elapsed clock time) and about 10,000 bytes of
  53. working storage.  About 90 per-cent of the time was taken up by
  54. file I/O.
  55.  
  56.  
  57. DIAGNOSTICS
  58.  
  59. Warning, bad option 'x':   The option is ignored.
  60.  
  61. Usage ...:   Two input files were not specified.
  62.  
  63. Can't open input file "filename":   Can't continue.
  64.  
  65. Out of space:   The program ran out of memory while comparing the
  66.                 two files.
  67.  
  68. Can't read line nnn at xxx in file[A/B]:   This indicates an I/O error
  69.                                            when seeking to the specific
  70.                                            line.  It should not happen.
  71.  
  72. Spurious match, output is not optimal:   Two lines that were different
  73.                                          yielded the same hash value.
  74.                                          This is harmless except that the
  75.                                          difference output is not the
  76.                                          minimum set of differences between
  77.                                          the two files.  For example, instead
  78.                                          of the output:
  79.  
  80.     lines 1 to 5 were changed to ...     the program will print
  81.  
  82.     lines 1 to 3 were changed to ...
  83.     lines 4 to 5 were changed to ...
  84.                                          The program uses a CRC16 hash code.
  85.                                          The likelihood of this error is
  86.                                          quite small.
  87.  
  88.  
  89. AUTHOR
  90.  
  91. The diff algorithm was developed by J. W. Hunt and M. D. McIlroy,
  92. using a central algorithm defined by H. S. Stone.
  93.  
  94. It was published in:
  95.  
  96.     Hunt, J. W., and McIlroy, M. D.,
  97.     An Algorithm for Differential File Comparison,
  98.     Computing Science Technical Report #41,
  99.     Bell Laboratories, Murray Hill, NJ  07974
  100.  
  101.  
  102. BUGS
  103.  
  104. On RSX and DECUS C on VMS systems, diff may fail if the both
  105. files are not "variable-length, implied carriage control" format.
  106. The scopy program can be used to convert files to this format if
  107. problems arise.
  108.  
  109. When compiled under VAX C, diff handles STREAM_LF files properly
  110. (in addition to the canonical variable-length implied carriage
  111. control files).  Other variations should work, but have not been
  112. tested.
  113.  
  114.  
  115. When compiled under VAX C, diff is quite slow for unknown reasons
  116. which ought to be investigated.  On the other hand, it has access
  117. to effectively unlimited memory.
  118.  
  119.  
  120. Output in a form suitable for ed - the -e option - seems rather
  121. pointless; the analogue on DEC systems is SLP (SUMSLP on VMS).  It
  122. would be simple to provide SLP-compatible output.  The question
  123. is, why bother - since the various DEC file comparison utilities
  124. already produce it.
  125.  
  126. ============================================================================
  127.  
  128. README:
  129.  
  130. 17-JAN-88
  131.  
  132. This is a enhanced version of the diff program that was posted to
  133. comp.sources.misc recently. The diff now uses less memory, is almost
  134. as fast as the UNIX diff and it produces "new style" context diffs.
  135.  
  136.                                 Johan Widen
  137.                                 jw@sics.se
  138.  
  139. ============================================================================
  140.  
  141. README.old:
  142.  
  143. Here's a public domain diff with the -b and -c options.  (4.2bsd style
  144. contex diffs.)  I wasn't aware that these wern't present in all UNIX
  145. versions of diff, so I didn't think posting it was a priority.
  146.  
  147. It's large, slow, and many of the comments are no longer true, but it
  148. does work  (except when it runs out of memory).  The one case I know of
  149. where its output is incompatable with patch does seem to be pretty
  150. rare.
  151.  
  152. No makefile is included, the 4.2bsd diff is better on the unix system I
  153. If you don't know how to compile and load a single C program, this probably
  154. isn't the tool for you anyway.
  155.  
  156. I'd be grateful to anyone who cleans this up and documents it properly.
  157. It does appear to have been separate files at some point; I'm presenting
  158. it in a form similar to how I got it:  mail headers and outdated
  159. documentation in comments and all.  I just banged on it enough to get it
  160. doing what I wanted.
  161.  
  162.